<%@page import="model.Province"%>
<%@page import="java.util.ArrayList" contentType="text/html; charset=UTF-8"%>
<%
 request.setCharacterEncoding("UTF-8"); 
 ArrayList<String> typeRealEstate = (ArrayList<String>) request.getAttribute("typeRealEstate");
 ArrayList<String> typeService = (ArrayList<String>) request.getAttribute("typeService");
 ArrayList<Province> provinces = (ArrayList<Province>) request.getAttribute("provinces");
 ArrayList<String> districts = (ArrayList<String>) provinces.get(0).getDistricts();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link type="text/css" rel="stylesheet" href="/css/ui-lightness/jquery-ui-1.8.18.custom.css" />
<script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
    $(document).ready(function () {
        //$.datepicker.setDefaults( $.datepicker.regional[ "vi" ] );
        // Datepicker
        $('.date-from, .date-to').datepicker({
            inline: true,
            dateFormat: 'dd-mm-yy',
            currentText: 'Now',
            onSelect: function(dateText, inst) {
                //alert(dateText);
            }
        });
    });
});
</script>
</head>
<body>
    <form action="/search" method="post">
        <label>Key</label>
        <input type="text" name="key">
        <label>Date From</label>
        <input type="text" name="from" class="date-from">
        <label>Date To</label>
        <input type="text" name="to" class="date-to">
        <br />
        <label>Service Type</label>
        <select name="typeService">
           <% for (int i = 0; i < typeService.size(); i++) { %>
           <option value="<%=typeService.get(i)%>"><%=typeService.get(i)%></option>
           <% } %>
        </select>
        <label>RealEstate Type</label>
        <select name="typeRealEstate">
           <% for (int i = 0; i < typeRealEstate.size(); i++) { %>
           <option value="<%=typeRealEstate.get(i)%>"><%=typeRealEstate.get(i)%></option>
           <% } %>
        </select>
        <select name="province">
            <% for (int i = 0; i < provinces.size(); i++) { %>
            <option value="<%=provinces.get(i).getName()%>"><%=provinces.get(i).getName()%></option>
            <% } %>
        </select>
        
        <select name="district">
            <% for (int i = 0; i < districts.size(); i++) { %>
            <option value="<%=districts.get(i)%>"><%=districts.get(i)%></option>
            <% } %>
        </select>
        <button type="submit">Search</button>
    </form>
</body>
</html>